package com.bwie.controller;

import com.bwie.pojo.TbPost;
import com.bwie.service.TbPostService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/index")
public class IndexController {

    @Autowired
    TbPostService postService;

  @PostMapping("/getPostList")
  public R getPostList(@RequestBody PageInfoVo pageInfoVo){
      return postService.getPostList(pageInfoVo);
  }

    @PostMapping("/getCount/{postId}")
    public R getCount(@PathVariable("postId")Integer postId){
      return postService.getCount(postId);
    }

    @PostMapping("/saveCar")
    public R saveCar(@RequestBody TbPost tbPost){
      return postService.sAdd(tbPost);
    }

    @PostMapping("/getPostId/{postId}")
    public R getPostId(@PathVariable("postId")Integer postId){
      return postService.getPostDesp(postId);
    }
}
